import request from "@/utils/request";
import type { GetRoleListResponse } from "./model/roleModel";
enum Api {
  getRoleListUrl = `/admin/acl/role`,
  getSaveRoleListUrl = `/admin/acl/role/save`,
}
/**
 * 获取分页
 * @param page
 * @param limit
 * @param roleName
 * @returns
 */
export const getRoleListApi = (page: number, limit: number, roleName = "") => {
  return request.get<any, GetRoleListResponse>(
    Api.getRoleListUrl + `/${page}/${limit}`,
    {
      params: {
        roleName,
      },
    }
  );
};
/**
 * 添加角色
 * @param roleName
 * @returns
 */
export const getSaveRoleListApi = (roleName: string) => {
  return request.post<any, null>(Api.getSaveRoleListUrl, { roleName });
};
